<script setup>

import { ref, onMounted } from 'vue'
const num = ref(0)
const isActive = ref(false)
const str = ref("天津天狮学院")
function change() {
  num.value++
  isActive.value = true
}
function clear() {
  num.value = 0
}
function alter() {
  str.value = "我爱天津"
  isActive.value =true
}

</script>

<template>
  <div class="container">
    <h1 :class="{'title_01' : isActive}">{{str}}</h1>
    <div class="button-group">
      <button class="btn" hover-class="button-hover" @click="change">加一</button>
      <button class="btn" hover-class="button-hover" @click="clear">归零</button>
      <button class="btn" hover-class="button-hover" @click="alter">这是一个按钮</button>
    </div>
    <h3 class="counter">当前数字：{{ num }}</h3>
  </div>
</template>

<style scoped>

.container {
  max-width: 600px;
  margin: 2rem auto;
  padding: 2rem;
  text-align: center;
}

.title {
  font-size: 32px;
  margin-bottom: 2rem;
  color: #2c3e50;
  /* 更深的主题色 */
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.title_01 {
  font-size: 32px;
  margin-bottom: 2rem;
  color: #f70612;
  /* 更深的主题色 */
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

/* 按钮组样式 */
.button-group {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
}

/* 按钮基础样式 */
.btn {
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  background-color: #3498db;
  /* 主题蓝色 */
  color: white;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.button-hover {
  background-color: #2980b9;
  /* 更深的蓝色 */
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 计数器样式 */
.counter {
  font-size: 24px;
  color: #2ecc71;
  /* 绿色强调色 */
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  display: inline-block;
  min-width: 200px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
</style>
